<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>TODO supply a title</title>
    </head>
    <body>
        <div>
            <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                            xmlns:ui="http://java.sun.com/jsf/facelets"
                            xmlns:h="http://java.sun.com/jsf/html"
                            xmlns:f="http://java.sun.com/jsf/core"
                            xmlns:a4j="http://richfaces.org/a4j"
                            xmlns:rich="http://richfaces.org/rich">
                <style type="text/css">
                    .pic{
                        margin-bottom: -4px;
                        margin-right: -2px;
                        border:none;
                    }
                    .inputText{
                        margin:5px 5px 5px 5px;
                    }
                    input[type = 'submit']{
                        margin:5px 0px 5px 10px;
                        padding:3px 5px 3px 5px;
                    }
                        .context-height{
                             min-height: 508px;
                        }
                </style>
                <h:form id="aa">
                    <h:panelGroup>
                        <rich:tabPanel switchType="client">
                            <rich:tab header="部门项目预算分配" contentClass="context-height">
                                <rich:toolbar  itemSeparator="grid">
                                    <rich:toolbarGroup>
                                        <a4j:commandButton value="编辑" render="edit,deptinfo,editTable"
                                                           action="#{budgetAllotBean.updatedeptProjData}"/>
                                        <a4j:commandButton value="保存" render="edit,errmessage,deptinfo,editTable"
                                                           action="#{budgetAllotBean.savedeptProjData}"/>
                                    </rich:toolbarGroup>
                                </rich:toolbar>
                                <h:panelGrid columns="2" width="100%" columnClasses="col1,col2"  id="edit">
                                    <h:panelGroup>
                                        <h:outputLabel id="projerrmessage" value="#{queryBean.err.errtip}" style="color:red" />
                                        <h:panelGrid columns="3" id="editGrid">
                                            <h:outputText value="年度:"/>
                                            <h:selectOneMenu  id="startYear"  value="#{budgetAllotBean.currentYear}">
                                                <f:selectItem itemValue="0" itemLabel="-请选择-"/>
                                                <f:selectItems value="#{budgetAllotBean.yearli}"/>
                                                <a4j:ajax event="change" listener="#{budgetAllotBean.changeFinProjList}"
                                                          execute="@this"
                                                          render="usern,editTable"/>
                                            </h:selectOneMenu>
                                            <h:message for="startYear"/>

                                            <h:outputText value="部 门: " />
                                            <h:selectOneMenu id="deptcode" value="#{budgetAllotBean.deptproj.deptCode}">
                                                <f:selectItem itemValue="" itemLabel="-请选择-"/>
                                                <f:selectItems value="#{budgetAllotBean.selectItemList}"/>
                                                <a4j:ajax event="change"
                                                          listener="#{budgetAllotBean.changeFinProjList}"
                                                          execute="@this"
                                                          render="usern,editTable"/>
                                            </h:selectOneMenu>
                                            <h:message for="deptcode"/>

                                            <h:outputLabel value="财务项目: " />
                                            <a4j:commandLink id="usern" value="打开项目列表"
                                                             onclick="#{rich:component('panel')}.show();"
                                                             disabled="#{budgetAllotBean.currentYear == 0
                                                                         or (empty budgetAllotBean.deptproj.deptCode)}"
                                                             render="editTablea"/>
                                            <h:message for="usern"/>
                                        </h:panelGrid>
                                    </h:panelGroup>
                                </h:panelGrid>


                                <div style="width:600px;overflow:auto;">
                                    <rich:dataTable style="width:100%">
                                        <f:facet name="header">
                                            <rich:columnGroup>
                                                <rich:column style="width:100px">
                                                    财务项目代码
                                                </rich:column>
                                                <rich:column style="width:220px;">
                                                    财务项目名称
                                                </rich:column>
                                                <rich:column style="width:180px">
                                                    预算数
                                                </rich:column>
                                                <rich:column>
                                                    操作
                                                </rich:column>
                                            </rich:columnGroup>
                                        </f:facet>
                                    </rich:dataTable>
                                    <div style="height:360px;overflow:auto;">
                                        <rich:dataTable id="editTable" value="#{budgetAllotBean.dataModel}" var="pro"
                                                        onrowmouseover="this.style.backgroundColor='#F1F1F1'"
                                                        onrowmouseout="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
                                                        rowClasses="list-row-odd,list-row-even"
                                                        style="width:100%;margin-bottom: 5px;"
                                                        noDataLabel="无数据!">
                                            <rich:column style="width:100px">
                                                <h:outputText value="#{pro.projCode}"/>
                                            </rich:column>
                                            <rich:column style="width:220px;">
                                                <h:outputText value="#{pro.projName}"/>
                                            </rich:column>
                                            <rich:column style="width:180px">
                                                <h:inputText value="#{pro.budget}" disabled ="#{budgetAllotBean.editAble}"
                                                             required="true" requiredMessage="不能为空">
                                                    <f:convertNumber type="number" pattern="#,##0.00"/>
                                                </h:inputText>
                                            </rich:column>
                                            <rich:column>
                                                <h:commandLink action="#{budgetAllotBean.deletedeptProjData}">
                                                    <h:outputText value="删除"/>
                                                </h:commandLink>
                                            </rich:column>
                                        </rich:dataTable>
                                    </div>
                                </div>
                            </rich:tab>
                            <rich:tab header="部门项目预算信息" contentClass="context-height">
                                <rich:toolbar  itemSeparator="grid" id="toolbar">
                                    <rich:toolbarGroup>
                                        <a4j:commandButton action="#{budgetAllotBean.selectAllDataList}"  render="alldatas,toolbar" value="查询"/>
                                        <a4j:commandButton action="#{budgetAllotBean.saveAllData}"  render="alldatas,toolbar" value="保存"/>
                                        <a4j:commandButton action="#{budgetAllotBean.deleteAllData}"  render="alldatas,toolbar" value="删除"/>
                                    </rich:toolbarGroup>
                                </rich:toolbar>
                                <h:panelGroup>
                                    <h:selectOneMenu  value="#{budgetAllotBean.iyear}" >
                                        <f:selectItem itemValue="0" itemLabel=" 请选择年度 "/>
                                        <f:selectItems value="#{budgetAllotBean.yearli}"/>
                                    </h:selectOneMenu>年
                                </h:panelGroup>
                                <div style="width:700px;">
                                    <rich:dataTable style="width:100%">
                                        <f:facet name="header">
                                            <rich:columnGroup>
                                                <rich:column style="width:40px;">
                                                    <h:selectBooleanCheckbox value="#{budgetAllotBean.isallselect}" id="slectall1">
                                                        <a4j:ajax event="click" render="alldatas"
                                                                  listener="#{budgetAllotBean.selectAll}"/>
                                                    </h:selectBooleanCheckbox>
                                                </rich:column>
                                                <rich:column style="width:80px;">
                                                    财务项目代码
                                                </rich:column>
                                                <rich:column style="width:240px;">
                                                    财务项目名称
                                                </rich:column>
                                                <rich:column style="width:80px;">
                                                    项目所属部门
                                                </rich:column>
                                                <rich:column>
                                                    预算数
                                                </rich:column>
                                            </rich:columnGroup>
                                        </f:facet>
                                    </rich:dataTable>
                                    <div style="height:260px;overflow:auto">
                                        <rich:dataTable style="width:100%"
                                                        id="alldatas"
                                                        value="#{budgetAllotBean.alldataList}"
                                                        var="pro"
                                                        onrowmouseover="this.style.backgroundColor='#F1F1F1'"
                                                        onrowmouseout="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
                                                        noDataLabel="无数据!">
                                            <rich:column style="width:40px;text-align:center">
                                                <h:selectBooleanCheckbox value="#{pro.selected}">
                                                    <a4j:ajax event="click" render="alldatas"/>
                                                </h:selectBooleanCheckbox>
                                            </rich:column>
                                            <rich:column style="width:80px;">
                                                <h:outputText value="#{pro.projCode}"/>
                                            </rich:column>
                                            <rich:column style="width:240px;">
                                                <h:outputText value="#{pro.projName}"/>
                                            </rich:column>
                                            <rich:column style="width:80px;">
                                                <h:outputText value="#{pro.deptName}"/>
                                            </rich:column>
                                            <rich:column>
                                                <h:inputText value="#{pro.budget}" disabled ="#{!pro.selected}" style="width:100%">
                                                    <f:convertNumber type="number" pattern="#,##0.00"/>
                                                </h:inputText>
                                            </rich:column>
                                        </rich:dataTable>
                                    </div>
                                </div>
                            </rich:tab>
                            <rich:tab id="tab2" header="部门项目预算统计" contentClass="context-height">
                                <h:panelGroup id="toolbar1">
                                    <rich:toolbar itemSeparator="grid">
                                        <rich:toolbarGroup>
                                            <a4j:commandButton action="#{budgetAllotBean.selectDataTotalList}"
                                                               render="tab2" value="查询"/>
                                        </rich:toolbarGroup>
                                    </rich:toolbar>
                                    <h:selectOneMenu  value="#{budgetAllotBean.iyearValue}" >
                                        <f:selectItem itemValue="0" itemLabel=" 请选择年度 "/>
                                        <f:selectItems value="#{budgetAllotBean.yearli}"/>
                                    </h:selectOneMenu>年
                                </h:panelGroup>
                                <div style="width:700px;">
                                    <rich:dataTable style="width:100%">
                                        <f:facet name="header">
                                            <rich:columnGroup>
                                                <rich:column style="width:120px;">
                                                    项目所属部门
                                                </rich:column>
                                                <rich:column style="width:80px;">
                                                    财务项目代码
                                                </rich:column>
                                                <rich:column style="width:200px;">
                                                    财务项目名称
                                                </rich:column>
                                                <rich:column>
                                                    预算数
                                                </rich:column>
                                            </rich:columnGroup>
                                        </f:facet>
                                    </rich:dataTable>
                                    <div style="height:260px;overflow:auto">
                                        <rich:dataTable style="width:100%"
                                                        id="alldatas1"
                                                        value="#{budgetAllotBean.dataTotalList}"
                                                        var="pro"
                                                        onrowmouseover="this.style.backgroundColor='#F1F1F1'"
                                                        onrowmouseout="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
                                                        noDataLabel="无数据!">
                                            <rich:column style="width:120px;">
                                                <h:outputText value="#{pro.deptName}"/>
                                            </rich:column>
                                            <rich:column style="width:80px;">
                                                <h:outputText value="#{pro.projCode}"/>
                                            </rich:column>
                                            <rich:column style="width:200px;">
                                                <h:outputText value="#{pro.projName}"/>
                                            </rich:column>
                                            <rich:column style="text-align:right;">
                                                <h:outputText value="#{pro.budget}">
                                                    <f:convertNumber type="number" pattern="#,##0.00"/>
                                                </h:outputText>
                                            </rich:column>
                                        </rich:dataTable>
                                    </div>
                                </div>
                            </rich:tab>
                        </rich:tabPanel>
                    </h:panelGroup>
                </h:form>
                <rich:popupPanel id="panel" autosized="true">
                    <f:facet name="header">项目数据</f:facet>
                    <f:facet name="controls">
                        <h:outputLink value="#" onclick="#{rich:component('panel')}.hide()">关闭</h:outputLink>
                    </f:facet>
                    <h:form>
                        <rich:panel>
                            <div style="width:500px;">
                                <rich:dataTable style="width:100%;">
                                    <f:facet name="header">
                                        <rich:columnGroup>
                                            <rich:column style="width:30px;text-align:center">
                                                选择
                                            </rich:column>
                                            <rich:column style="width:200px;">
                                                财务项目
                                            </rich:column>
                                            <rich:column style="width:60px;">
                                                负责人
                                            </rich:column>
                                            <rich:column style="width:60px;">
                                                项目年度
                                            </rich:column>
                                            <rich:column>
                                                备注
                                            </rich:column>
                                        </rich:columnGroup>
                                    </f:facet>
                                </rich:dataTable>
                                <div style="height:260px;overflow:auto;">
                                    <rich:dataTable id="editTablea" value="#{budgetAllotBean.finlist}" var="pro"
                                                    onrowmouseover="this.style.backgroundColor='#F1F1F1'"
                                                    onrowmouseout="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
                                                    rowClasses="list-row-odd,list-row-even"
                                                    style="width:100%">
                                        <rich:column style="width:30px;text-align:center">
                                            <h:selectBooleanCheckbox  value="#{pro.selected}"/>
                                        </rich:column>
                                        <rich:column style="width:200px;">
                                            <h:outputText value="#{pro.name}"/>
                                        </rich:column>
                                        <rich:column style="width:60px;">
                                            <h:outputText value="#{pro.managerName}"/>
                                        </rich:column>
                                        <rich:column style="width:60px;">
                                            <h:outputText value="#{pro.iyear}"/>
                                        </rich:column>
                                        <rich:column>
                                            <div style="width:60px;">
                                                <h:outputText title="#{pro.memo}" value="#{pro.memo}"/>
                                            </div>
                                        </rich:column>
                                    </rich:dataTable>
                                </div>
                            </div>
                            <center>
                                <h:panelGroup>
                                    <a4j:commandButton id="combhidelink" value="确定" action="#{budgetAllotBean.adddeptProjData}"
                                                       onclick="#{rich:component('panel')}.hide();" render="usern,editTable" />
                                    <a4j:commandButton value="取消" onclick="#{rich:component('panel')}.hide();"/>
                                </h:panelGroup>
                            </center>
                        </rich:panel>
                    </h:form>

                    <f:facet name="footer">
                        footer!
                    </f:facet>
                </rich:popupPanel>
            </ui:composition>
        </div>
    </body>
</html>
